﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace InformationExtraction.Common
{
    class Document
    {
        /// <summary>
        /// 文档的行数
        /// </summary>
        public int LineCount
        {
            get 
            {
                if (Lines == null)
                    return 0;

                return Lines.Count;
            }
        }

        /*
        /// <summary>
        /// 文档的句子数
        /// </summary>
        public int SentenceCount
        {
            get 
            {
                if (Sentenses == null)
                    return 0;

                return Sentenses.Count;
            }
        }

        
        /// <summary>
        /// 文档中的Token数
        /// </summary>
        public int TokenCount
        {
            get
            {
                int nToken = 0;

                foreach (Line line in Lines)
                {
                    nToken += line.TokenCount;
                }

                return nToken;
            }
        }
        */

        /// <summary>
        /// 文档按行组织的内容
        /// </summary>
        public List<Line> Lines
        {
            get;
            set;
        }

        /*
        /// <summary>
        /// 文档按句子组织的内容
        /// </summary>
        public List<Sentence> Sentenses
        {
            get;
            set;
        }
        */

        /// <summary>
        /// 文档的内容
        /// </summary>
        public string Content
        {
            get;
            set;
        }
        
        /// <summary>
        /// 获得文档的第一个Token
        /// </summary>
        public Token BeginToken
        {
            get
            {
                if (LineCount == 0)
                    return null;

                return Lines[0].TokenCount == 0 ? null : Lines[0].Tokens[0];
            }
        }
    }
}
